package com.sywb.chuangyebao.view;

import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.sywb.chuangyebao.R;
import com.sywb.chuangyebao.contract.ManuscriptStypeContract;
import com.sywb.chuangyebao.utils.Utils;
import com.sywb.chuangyebao.widget.SuperViewPager;
import com.sywb.chuangyebao.widget.XTabLayout;

import org.bining.footstone.widget.PullToRefreshView;

import butterknife.BindView;

public class ManuscriptStypeActivity extends ActionbarActivity<ManuscriptStypeContract.ManuscriptStypePresenter> implements ManuscriptStypeContract.ManuscriptStypeIView{
    @BindView(R.id.manuscript_tab)
    XTabLayout manuscriptTab;
    @BindView(R.id.manuscript_viewpager)
    SuperViewPager manuscriptViewPager;
    private String strExtra="";
    private int type;
    @Override
    public void initView(Bundle bundle) {
        super.initView(bundle);
        if (bundle==null){
            if (getIntent()!=null){
                strExtra= getIntent().getStringExtra("p0");
                type =getIntent().getIntExtra("p1",0);
                setTitle(strExtra);
            }
        }
        addMenuTextItme(R.string.publish, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (Utils.checkIsNext(getUserFragmentManager())){
                    switch (type){
                        case 0:
                            advance(PublishArticleActivity.class);
                            break;
                        case 1:
                            advance(PublishVideoActivity.class);
                            break;
                    }
                }
            }
        });
    }

    @Override
    public int getLayoutId(Bundle bundle) {
        return R.layout.activity_manuscript_stype;
    }

    @Override
    public void initPresenter() {
        mPresenter.initPresenter(this);
        mPresenter.initTabView(type,manuscriptViewPager,manuscriptTab);
    }

    @Override
    public FragmentManager getUserFragmentManager() {
        return getSupportFragmentManager();
    }
}
